<?php

class DB_URL_IE extends ORM_Table {
    static protected $table_name = 'url_ie';
    
    static public function getTableName($params = null) {
        //$table_name = self::$table_name.substr($params['article_type_id'], 0, 1);
        return self::$table_name;
    }
    
    static public function setUpdate($uhash) {
        
        if(empty($_SESSION['user']['id'])){
            $uid    = 0;
        }else{
            $uid    =$_SESSION['user']['id'];
        }
        
        $ie     = getIeName();
        $has    = ORM_Finder::findOne(DB_URL_IE,"name='$ie' and uhash='$uhash'");
        if($has) {
            $has->setClick($has->getClick()+1);
            $has->save();
        }else{
            $has    = new DB_URL_IE();
            $has->setUhash($uhash);
            $has->setName($ie);
            $has->save();
        }
        return $has;
    }
}

